<!DOCTYPE HTML>
<html>
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>人工外观检验项目</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
    <script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div class="container" id="container">
        <div id="divList">
        </div>
        <div class="weui_cells weui_cells_form">
            <div id="divLWCX_Info">
            <div class="weui_cells_title">联网查询结果描述</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtLWCXJGMS" class="weui_textarea" placeholder="请输入联网查询结果描述" rows="2"></textarea>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">手机号码</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtSJHM" class="weui_input" type="number" placeholder="手机号码"/>
                    </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系地址</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtLXDZ" class="weui_input" placeholder="联系地址"/>
                    </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">邮政编码</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtYZBM" class="weui_input" type="number" placeholder="邮政编码"/>
                    </div>
            </div>
            </div>
            <div class="weui_cells_title">变更后发动机号</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtBGHFDJH" class="weui_textarea" placeholder="变更后发动机号" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">变更后发动机型号</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtBGHFDJXH" class="weui_textarea" placeholder="变更后发动机型号" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">唯一性检查检验员建议</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtWYXJC_JYYJY" class="weui_textarea" placeholder="唯一性检查检验员建议" rows="3"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">唯一性检查备注</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtWYXJCBZ" class="weui_textarea" placeholder="唯一性检查备注" rows="3"></textarea>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">车外廓长</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtCWKC" class="weui_input" type="number" placeholder="mm"/>
                    </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">车外廓宽</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtCWKK" class="weui_input" type="number" placeholder="mm"/>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">车外廓高</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtCWKG" class="weui_input" type="number" placeholder="mm"/>
                    </div>
            </div>
            <div class="weui_cells_title">轴距</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtZJ" class="weui_textarea" placeholder="多个轴距用英文半角“+”分隔" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">车厢栏板高度</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtCXLBGD" class="weui_input" type="number" placeholder="mm"/>
            </div>
            </div>
             <div class="weui_cells_title">单车转向轮轮胎花纹深度</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtDCZXLHWSD" class="weui_textarea" placeholder="A1:12/A2:13/B1:12/B2:13" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">单车其他轮轮胎花纹深度</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtDCQTLHWSD" class="weui_textarea" placeholder="C1:12/C2:13/D1:12/D2:13" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">挂车轮胎花纹深度</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtGCHWSD" class="weui_textarea" placeholder="C1:12/C2:13/D1:12/D2:13" rows="1"></textarea>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">第一轴左高度</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtYZZGD" class="weui_input" type="number" placeholder="(挂车不填)mm"/>
            </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">第一轴右高度</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtYZYGD" class="weui_input" type="number" placeholder="(挂车不填)mm"/>
            </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">第一轴高度差</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtYZZYGDC" class="weui_input" type="number" placeholder="(挂车不填)mm"/>
            </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">最后轴左高度</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtZHZZGD" class="weui_input" type="number" placeholder="mm"/>
            </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">最后轴右高度</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtZHZYGD" class="weui_input" type="number" placeholder="mm"/>
            </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">最后轴高度差</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <input id="txtZHZZYGDC" class="weui_input" type="number" placeholder="mm"/>
            </div>
            </div>
            <div class="weui_cells_title">检验员建议</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtJYYJY" class="weui_textarea" placeholder="请输入建议" rows="3"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">合格项汇总</div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                 <textarea class="weui_textarea" style="color: green" id="txtHGXM" readonly="readonly" placeholder="" rows="3"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">不合格项汇总</div>
            <div class="weui_cell">
                 <div class="weui_cell_bd weui_cell_primary">
                 <textarea class="weui_textarea" style="color: red" id="txtBHGX" readonly="readonly" placeholder="" rows="5"></textarea>
                </div>
            </div> 
            <div class="weui_cells_title">详细不合格项汇总</div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                     <textarea class="weui_textarea" style="color: red" id="txtBHGX_Sub" readonly="readonly" placeholder="" rows="5"></textarea>
                </div>
            </div> 
            <div class="weui_cells_title">不判定项汇总</div>
            <div class="weui_cell" style="height:80px">
                <div class="weui_cell_bd weui_cell_primary">
                     <textarea class="weui_textarea" id="txtPBXM" readonly="readonly" placeholder="" rows="5"></textarea>
                </div>
            </div>  
        </div>

        <div class="weui_cells_title">是否全时/适时四驱</div>
            <div class="weui_cells weui_cells_radio">
               <label class="weui_cell weui_check_label" for="radQSSQ_K">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>未确认</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" class="weui_check" name="radQSSQ" id="radQSSQ_K" value="" checked="checked">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                 <label class="weui_cell weui_check_label" for="radQSSQ_F">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>否</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radQSSQ" class="weui_check" id="radQSSQ_F" value="0">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                <label class="weui_cell weui_check_label" for="radQSSQ_S">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>是</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radQSSQ" class="weui_check" id="radQSSQ_S" value="1" >
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
               
        </div>

        <div class="weui_cells_title">驻车制动是否使用电子控制装置</div>
            <div class="weui_cells weui_cells_radio">
                <label class="weui_cell weui_check_label" for="radDZSS_K">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>未确认</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" class="weui_check" name="radDZSS" id="radDZSS_K" value="" checked="checked">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                 <label class="weui_cell weui_check_label" for="radDZSS_F">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>否</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radDZSS" class="weui_check" id="radDZSS_F" value="0">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                <label class="weui_cell weui_check_label" for="radDZSS_S">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>是</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radDZSS" class="weui_check" id="radDZSS_S" value="1">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
               
        </div>

        <div class="weui_cells_title">是否配备空气悬架</div>
            <div class="weui_cells weui_cells_radio">
                <label class="weui_cell weui_check_label" for="radKQXJ_K">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>未确认</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" class="weui_check" name="radKQXJ" id="radKQXJ_K" value="" checked="checked">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                <label class="weui_cell weui_check_label" for="radKQXJ_F" >
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>否</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radKQXJ" class="weui_check" id="radKQXJ_F" value="0">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
                <label class="weui_cell weui_check_label" for="radKQXJ_S">
                    <div class="weui_cell_bd weui_cell_primary">
                        <p>是</p>
                    </div>
                    <div class="weui_cell_ft">
                        <input type="radio" name="radKQXJ" class="weui_check" id="radKQXJ_S" value="1">
                        <span class="weui_icon_checked"></span>
                    </div>
                </label>
               
        </div>

            <div class="weui_cells_title">空气悬架轴位置</div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                     <textarea class="weui_textarea" id="txtKQXJZ"  placeholder="1,2,3,4" rows="1"></textarea>
                </div>
            </div> 

            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">转向轴数量</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input id="txtZXZSL" class="weui_input"  pattern="[0-9]*" placeholder="1"/>
                </div>
            </div>
            <div class="weui_cells_title">车辆特征参数备注</div>
            <div class="weui_cells weui_cells_form">
            </div>
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtTZCSBZ" class="weui_textarea" value=" " rows="3"></textarea>
                </div>
            </div>
            <div class="weui_cells_title">强制不检测项目</div>
            <div class="weui_cells weui_cells_form">
            </div>
             <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea id="txtQZBJYXM" class="weui_textarea" value=" " rows="1"></textarea>
                </div>
            </div>
             <div class="weui_cell">
                 <div class="weui_cell_hd"><label class="weui_label">检测线号</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="select" style="width: 200px" id="selectLineNum">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                        <option value="13">13</option>
                        <option value="14">14</option>
                        <option value="15">15</option>                        
                    </select>
                </div>
            </div>
          <div class="weui_cells_title">计时：<span id="time" style="font-size:30px;color:red">-</span>秒</div> 
        <br>
    <div class="mainbutton" id="divDZQM">
        <a class="weui_btn weui_btn_mini weui_btn_primary" style="display:inline-block; width: 29%" href="javascript:;" onclick="ShowDZQM(this)" id="btnShowDZQM" >显 示</a>
        <span style="display:inline-block; width: 2%"></span>
        <a class="weui_btn weui_btn_mini weui_btn_primary" style="display:inline-block; width: 29%" href="javascript:;" id="btnAddPhoto" onclick="SaveDZQM()"  >保 存</a>
        <span style="display:inline-block; width: 2%"></span>
        <a class="weui_btn weui_btn_mini weui_btn_primary" style="display:inline-block; width: 29%;" href="javascript:;" id="btnWGXM" onclick="ClearDZQM()"  >清 除</a> 
    </div> 
     <div class="space">
        
    </div>  
    <div class="mainbutton">
        <a class="weui_btn weui_btn_default" href="javascript:;" id="btnSaveWJ" onclick="SaveWJ()">提交外检</a>            
        </div>   
    </div>
    <div class="space">
        
    </div>
</body>
</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    var chkHGXM = [];
    var chkBHGX = [];
    var chkBHGX_SUB = [];
    var chkPBXM = [];
    var drawingBoard;
    var vLWCX_IsShow = '0';

    apiready = function(){
        var jsfun = "SetTitle('检验项目列表');";
        api.execScript({
            name: 'win_wgzplist',
            script: jsfun
        });
        //是否显示联网查询
        GetLWCX_IsShow();
        GetWJJYXM(api.pageParam.ID);

        $("#txtTZCSBZ").val(" ");

        //得到车辆特征参数
        GetCLTZCSInfo(api.pageParam.ID);

        drawingBoard = api.require('drawingBoard');
        drawingBoard.hide();


        //是否显示电子签名
        GetIsShowDZQM();

        var highestTimeoutId = setTimeout(";");
        for (var i = 0 ; i < highestTimeoutId ; i++) {
            clearTimeout(i); 
        }

        // 计时
        GetCLTZCSJCSeconds(api.pageParam.ID);
    };

     function after(iCount){
        $("#time").html(iCount);
        iCount=iCount+1;
        setTimeout(function(){
        if(iCount!=-1)
        {
            after(iCount);
                }
        },1000);
    }

    function CountingUp(iSumCount)
    {
        $(function(){
            setTimeout(function(){
            },iSumCount*1000);
                after(iSumCount);
            });
        }

    function GetCLTZCSJCSeconds(paraID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/GetCLTZCSJCSeconds/'+paraID,
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.IsSuccess) {
                var vSeconds = ret.Data;
                CountingUp(vSeconds);
            }
            else
            {
                api.alert({
                title: '提示',
                msg: ret.Message
                }, function(ret, err){
                    
                });
            }
        });
    }

    // 得到是否显示联网查询
    function GetLWCX_IsShow()
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');

        api.ajax({
                url: vUrlRead + '/WcfServices/LWCX_IsShow',
                method: 'Post',
                contentType: "application/json",
            }, function(ret, err) {
                 if (ret.IsSuccess) {
                    vLWCX_IsShow=ret.Data;

                    if(vLWCX_IsShow == "1")
                    {
                        $("#divLWCX_Info").show();

                        //得到联网查询的描述信息
                        GetLWCX_MS(api.pageParam.ID);
                    }
                    else
                    {
                        $("#divLWCX_Info").hide();
                    }
            }
        });
    }

    //得到车辆特征参数信息
    function GetCLTZCSInfo(paraID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');

        api.ajax({
                url: vUrlRead + '/WcfServices/GetCLTZCSJCVehicle/' + paraID,
                method: 'Post',
                contentType: "application/json",
            }, function(ret, err) {
                 if (ret.IsSuccess) {
                    //车外廓长
                    $("#txtCWKC").val(ret.Data.CWKC);
                    //车外廓宽
                    $("#txtCWKK").val(ret.Data.CWKK);
                    //车外廓高
                    $("#txtCWKG").val(ret.Data.CWKG);
                    //轴距
                    $("#txtZJ").val(ret.Data.ZJ);
                    //车厢栏板高度
                    $("#txtCXLBGD").val(ret.Data.CXLBGD);
                    //单车转向轮轮胎花纹深度
                    $("#txtDCZXLHWSD").val(ret.Data.DCZXLHWSD);
                    //单车其他轮轮胎花纹深度
                    $("#txtDCQTLHWSD").val(ret.Data.DCQTLHWSD);
                    //挂车轮胎花纹深度
                    $("#txtGCHWSD").val(ret.Data.GCHWSD);
                    //第一轴左高度
                    $("#txtYZZGD").val(ret.Data.YZZGD);
                    //第一轴右高度
                    $("#txtYZYGD").val(ret.Data.YZYGD);
                    //第一轴左右高度差
                    $("#txtYZZYGDC").val(ret.Data.YZZYGDC);
                    //最后轴左高度
                    $("#txtZHZZGD").val(ret.Data.ZHZZGD);
                    //最后轴右高度
                    $("#txtZHZYGD").val(ret.Data.ZHZYGD);
                    //最后轴左右高度差
                    $("#txtZHZZYGDC").val(ret.Data.ZHZZYGDC);
                    //是否全时/适时四驱
                    $("input[name='radQSSQ'][value='" + ret.Data.SFQSSQ + "']").attr("checked", true);
                    //驻车制动是否使用电子控制装置
                    $("input[name='radDZSS'][value='" + ret.Data.SFDZZC + "']").attr("checked", true);
                    //是否配备空气悬架
                    $("input[name='radKQXJ'][value='" + ret.Data.SFKQXJ + "']").attr("checked", true);  
                    //空气悬架轴位置
                    $("#txtKQXJZ").val(ret.Data.KQXJZ);
                    //转向轴数量
                    $("#txtZXZSL").val(ret.Data.ZXZSL);
                    //检验员建议
                    $("#txtJYYJY").val(ret.Data.JYYJY);
            }
        });
    }

    //得到联网查询的车辆信息.
    function GetLWCX_MS(LWID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/GetLWCXVehicle/' + LWID,
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.IsSuccess) {
               $("#txtLWCXJGMS").val(ret.Data.LWCXJGMS);
            }
        });
    }

    // 是否显示电子签名
    function GetIsShowDZQM()
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/PDAIsShowDZQM',
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.PDAIsShowDZQMResult.IsSuccess) {
                var vIsShowDZQM = ret.PDAIsShowDZQMResult.Data;
                if(vIsShowDZQM == "1")
                {
                    $("#divDZQM").show();
                }
                else
                {
                    $("#divDZQM").hide();
                }
            }
        });
    }

    function GetWJJYXM(paraID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/SHY_GetAllJYXM/' + paraID,
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.IsSuccess) {
                var vData = InitJYXMList(ret.Data);
                
                $("#btnSaveWJ").removeClass("weui_btn_default");
                $("#btnSaveWJ").addClass("weui_btn_primary");
            }
        });

        var vLineNum = $api.getStorage('LineNum');
        $("#selectLineNum").val(vLineNum);
    }

    function InitJYXMList(data)
    {
        var lstData = "<div id=\"divSubList\" class=\"weui_cells weui_cells_checkbox\">";
        for (var i = 0; i < data.length; i++) { 
            lstData += "<label class=\"weui_cell weui_check_label\" for=\"chkLst" + data[i].ID + "\" >";
            lstData += " <div class=\"weui_cell_bd weui_cell_primary\">";
            lstData += "   <p>" + data[i].XMID + "、" + data[i].XMMC + "</p>";
            lstData += " </div></label>";
            lstData += " <div style='width:100%; text-align:left; padding-left:20px;'>";
            if(data[i].IsBHGX)
            {// 不合格项目
                var indexBHGX = $.inArray(data[i].XMID, chkBHGX); 
                if (indexBHGX < 0) {
                    chkBHGX.push(data[i].XMID);
                }

                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Pass"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddHGXM(this);'/>合格</label> ";
                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Fail"+ data[i].XMID +"' checked=\"checked\" type=\"radio\" value='"+data[i].XMID+"' onclick='AddBHGX(this);' />不合格</label>";


                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Ppdx"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddBPDX(this);'/>不判定</label>";
            }
            else if(data[i].IsBJXM)
            {// 必检项目
                var indexHGXM = $.inArray(data[i].XMID, chkHGXM); 
                if (indexHGXM < 0) {
                    chkHGXM.push(data[i].XMID);
                }

                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Pass"+ data[i].XMID +"' checked=\"checked\" type=\"radio\" value='"+data[i].XMID+"' onclick='AddHGXM(this);'/>合格</label> ";
                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Fail"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddBHGX(this);' />不合格</label>";
                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Ppdx"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddBPDX(this);'/>不判定</label>";              
            }
            else if(data[i].IsPBXM)
            {// 屏蔽项目
                var indexPBXM = $.inArray(data[i].XMID, chkPBXM); 
                if (indexPBXM < 0) {
                    chkPBXM.push(data[i].XMID);
                }

                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Pass"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddHGXM(this);'/>合格</label> ";
                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Fail"+ data[i].XMID +"' type=\"radio\" value='"+data[i].XMID+"' onclick='AddBHGX(this);' />不合格</label>";
                lstData += " <label><input name='Pass"+ data[i].XMID +"' id='Ppdx"+ data[i].XMID +"'  checked=\"checked\"  type=\"radio\" value='"+data[i].XMID+"' onclick='AddBPDX(this);'/>不判定</label>";  
            }

            //data[i].IsBHGX = true;
            if(data[i].IsBHGX)
            {
                lstData += "<div id=\"divSub"+data[i].XMID+"\" class=\"weui_cells weui_cells_checkbox\">";
            }
            else
            {
                lstData += "<div id=\"divSub"+data[i].XMID+"\" style=\"display:none;\" class=\"weui_cells weui_cells_checkbox\">";
            }

            for(var y=0;y<data[i].JYXM_SUB.length;y++)
            {
                lstData += "<label class=\"weui_cell weui_check_label\" for=\"chk"+data[i].JYXM_SUB[y].XMDH+"\">";
                lstData += "<div class=\"weui_cell_hd\">";
                if(data[i].JYXM_SUB[y].IsBHGX)
                {
                    lstData += "<input type=\"checkbox\" class=\"weui_check\" checked=\"checked\" name=\"chk"+data[i].JYXM_SUB[y].XMDH+"\" id=\"chk"+data[i].JYXM_SUB[y].XMDH+"\" value='"+data[i].JYXM_SUB[y].XMDH+"' onclick='AddBHGX_Sub(this)' >";

                    var indexBHGX_Sub = $.inArray(data[i].JYXM_SUB[y].XMDH, chkBHGX_SUB); 
                    if (indexBHGX_Sub < 0) {
                        chkBHGX_SUB.push(data[i].JYXM_SUB[y].XMDH);
                    }
                }
                else
                {
                    lstData += "<input type=\"checkbox\" class=\"weui_check\" name=\"chk"+data[i].JYXM_SUB[y].XMDH+"\" id=\"chk"+data[i].JYXM_SUB[y].XMDH+"\" value='"+data[i].JYXM_SUB[y].XMDH+"' onclick='AddBHGX_Sub(this)' >";
                }
                lstData += "<i class=\"weui_icon_checked\"></i>";
                lstData += "</div>";
                lstData += "<div style=\"text-align:left; \" class=\"weui_cell_bd weui_cell_primary\">";
                lstData += "<p>"+data[i].JYXM_SUB[y].XMMC+"</p>";
                lstData += "</div>";
                lstData += "</label>";
            }
           
            lstData += "</div>";


            lstData += " </div> ";
        }

        lstData += "</div>";
        $("#divList").append(lstData);

         ChangedItems();
    }

    function SaveWJ()
    {
        var vClass = $("#btnSaveWJ").attr("class");
        var array=vClass.split(" "); 

        var vEnable = false;
        for(var i = 0;i<array.length;i++)
        {
            if(array[i] == "weui_btn_primary")
            {
                vEnable = true;
                break;
            }
        }

        if(vEnable)
        {  
            var vBHGX = $("#txtBHGX").val();

            if(vBHGX.length >0)
            {
                api.confirm({
                title: '提示',
                msg: '有不合格项目，是否继续提交？',
                buttons: ['是', '否']
                }, function(ret, err) {
                    var index = ret.buttonIndex;

                    if(index == 1)
                    {
                        SubmitResult();
                    }
                });
            }
            else
            {
               SubmitResult();
            }
        }
    }

    //提交最终结果
    function SubmitResult()
    {
        var vId = api.pageParam.ID;
        //联网查询结果描述
        var vLWCXJGMS = $("#txtLWCXJGMS").val(); 
        //手机号码
        var vSJHM = $("#txtSJHM").val();
        //联系地址
        var vLXDZ = $("#txtLXDZ").val();
        //邮政编码
        var vYZBM = $("#txtYZBM").val();
        //变更后发动机型号
        var vBGHFDJXH = $("#txtBGHFDJXH").val();
        //变更后发动机号
        var vBGHFDJH = $("#txtBGHFDJH").val();
        //唯一性检查 检验员建议
        var vWYXJC_JYYJY = $("#txtWYXJC_JYYJY").val();
        //车外廓长
        var vCWKC = $("#txtCWKC").val();
        //车外廓宽
        var vCWKK = $("#txtCWKK").val();
        //车外廓高
        var vCWKG = $("#txtCWKG").val();
        //轴距
        var vZJ = $("#txtZJ").val();
        //车厢栏板高度
        var vCXLBGD = $("#txtCXLBGD").val();
        //单车转向轮轮胎花纹深度
        var vDCZXLHWSD = $("#txtDCZXLHWSD").val();
        //单车其他轮轮胎花纹深度
        var vDCQTLHWSD = $("#txtDCQTLHWSD").val();
        //挂车轮胎花纹深度
        var vGCHWSD = $("#txtGCHWSD").val();
        //第一轴左高度
        var vYZZGD = $("#txtYZZGD").val();
        //第一轴右高度
        var vYZYGD = $("#txtYZYGD").val();
        //第一轴左右高度差
        var vYZZYGDC = $("#txtYZZYGDC").val();
        //最后轴左高度
        var vZHZZGD = $("#txtZHZZGD").val();
        //最后轴右高度
        var vZHZYGD = $("#txtZHZYGD").val();
        //最后轴左右高度差
        var vZHZZYGDC = $("#txtZHZZYGDC").val();
        //是否全时/适时四驱
        var vQSSQ = $("input[name='radQSSQ']:checked").val();
        //驻车制动是否使用电子控制装置
        var vDZSS = $("input[name='radDZSS']:checked").val();
        //是否配备空气悬架
        var vKQXJ = $("input[name='radKQXJ']:checked").val();
        //空气悬架轴位置
        var vKQXJZ = $("#txtKQXJZ").val();
        //转向轴数量
        var vZXZSL = $("#txtZXZSL").val();
        //检验员建议
        var vJYYJY = $("#txtJYYJY").val();
        //检测线代号
        var vJCXDH = $("#selectLineNum").val();
        //合格项目
        var vHGXM = $("#txtHGXM").val();
        //不合格项目
        var vBHGX = $("#txtBHGX").val();
        //不合格项目 子项目
        var vBHGX_Sub = $("#txtBHGX_Sub").val();
        //屏蔽项目
        var vPBXM = $("#txtPBXM").val();
        //唯一性检查备注
        var vWYXJCBZ = $("#txtWYXJCBZ").val();
        //特征参数备注
        var vTZCSBZ = $("#txtTZCSBZ").val();
        //强制不检验项目
        var vQZBJYXM = $("#txtQZBJYXM").val();
        //检验员用户名
        var vUserCHName = $api.getStorage('UserCHName');
        //身份证号
        var vUserSFZH = $api.getStorage('UserSFZH');

        var vUrlWrite = $api.getStorage('ServerUrlWrite');

        if(vQSSQ == "")
        {
             api.alert({
                title: '提示',
                msg: '请确认【是否全时/适时四驱】,不能为未确认！'
            }, function(ret, err){
                
            });
            $("#btnSaveCLTZCSJC").removeClass("weui_btn_default");
            $("#btnSaveCLTZCSJC").addClass("weui_btn_primary");
            return;
        }

        if(vDZSS == "")
        {
             api.alert({
                title: '提示',
                msg: '请确认【驻车制动是否使用电子控制装置】,不能为未确认！'
            }, function(ret, err){
                
            });
            $("#btnSaveCLTZCSJC").removeClass("weui_btn_default");
            $("#btnSaveCLTZCSJC").addClass("weui_btn_primary");
            return;
        }

        if(vKQXJ == "")
        {
            api.alert({
                title: '提示',
                msg: '请确认【是否配备空气悬架】,不能为未确认！'
            }, function(ret, err){
               
            });
            $("#btnSaveCLTZCSJC").removeClass("weui_btn_default");
            $("#btnSaveCLTZCSJC").addClass("weui_btn_primary");
            return;
        }

        if(vKQXJ == "1")
        {
            if(vKQXJZ == "")
            {
                api.alert({
                title: '提示',
                msg: '请填写【空气悬架轴位置】,不能为空！'
            }, function(ret, err){
               
            });
            $("#btnSaveCLTZCSJC").removeClass("weui_btn_default");
            $("#btnSaveCLTZCSJC").addClass("weui_btn_primary");
            return;
            }
        }

        var vZXLTHWSD_YZ = Lthwsd_Valid(vDCZXLHWSD);
        var vQTLTHWSD_YZ = Lthwsd_Valid(vDCQTLHWSD);
        var vGCLTHWSD_YZ = Lthwsd_Valid(vGCHWSD);

        if(vZXLTHWSD_YZ == false)
        {
             api.alert({
                title: '提示',
                msg: '请正确填写单车转向轮轮胎花纹深度，冒号和斜线用英文键盘，格式为A1:12/A2:13/B1:12/B2:13'
            }, function(ret, err){
               
            });
            return;
        }

        if(vQTLTHWSD_YZ == false)
        {
             api.alert({
                title: '提示',
                msg: '请正确填写单车其他轮轮胎花纹深度，冒号和斜线用英文键盘，格式为C1:12/C2:13/D1:12/D2:13'
            }, function(ret, err){
               
            });
            return;
        }

        if(vGCLTHWSD_YZ == false)
        {
             api.alert({
                title: '提示',
                msg: '请正确填写挂车轮胎花纹深度，冒号和斜线用英文键盘，格式为C1:12/C2:13/D1:12/D2:13'
            }, function(ret, err){
               
            });
            return;
        }

        $.ajax({
            type: 'Post',
            url: vUrlWrite + '/WcfServices/SHY_SubmitData',
            contentType: "application/json", //必须有
            async: false,
            dataType: "json", //表示返回值类型，不必须
            //data: JSON.stringify({ 'UserName': 'admin', 'UserPwd': '123456' }),  //相当于 //data: "{'str1':'foovalue', 'str2':'barvalue'}",
            data: JSON.stringify({
                'PId': vId,
                'JCXDH': vJCXDH,
                'LWCXJGMS': vLWCXJGMS,
                'SJHM': vSJHM,
                'LXDZ': vLXDZ,
                'YZBM': vYZBM,
                'SFBGFDJ': "",
                'BGFDJXH': vBGHFDJXH,
                'BGFDJH': vBGHFDJH,
                'LWCX_JYYJY': "",
                'CLWYX_JYYJY': vWYXJC_JYYJY,
                'HGXM': vHGXM,
                'BHGX': vBHGX,
                'BHGX_Sub': vBHGX_Sub,
                'PBXM': vPBXM,
                'CWKC': vCWKC,
                'CWKK': vCWKK,
                'CWKG': vCWKG,
                'ZJ': vZJ,
                'CXLBGD': vCXLBGD,
                'DCZXLHWSD': vDCZXLHWSD,
                'DCQTLHWSD': vDCQTLHWSD,
                'GCHWSD': vGCHWSD,               
                'YZZGD': vYZZGD,
                'YZYGD': vYZYGD,
                'YZZYGDC': vYZZYGDC,
                'ZHZZGD': vZHZZGD,
                'ZHZYGD': vZHZYGD,
                'ZHZZYGDC': vZHZZYGDC,
                'SFQSSQ': vQSSQ,
                'SFDZZC': vDZSS,
                'SFKQXJ': vKQXJ,
                'KQXJZ': vKQXJZ,
                'ZXZSL': vZXZSL,
                'JYYJY': vJYYJY,
                'JYY': vUserCHName,
                'JYYSFZH': vUserSFZH,
                'WYXJCBZ':vWYXJCBZ,
                'TZCSBZ': vTZCSBZ,
                'QZBJYXM':vQZBJYXM,
            }),
            success: function(ret) {
                if (ret.SHY_SubmitDataResult) {
                    if(ret.SHY_SubmitDataResult.IsSuccess)
                        {
                            RefreshWGHome();
                        }
                        else
                        {
                            api.alert({
                                title: '错误',
                                    msg: ret.SubmitWJDataResult.Message,
                                }, function(ret, err){
                                $("#btnSaveWJ").removeClass("weui_btn_default");
                                $("#btnSaveWJ").addClass("weui_btn_primary");
                            });
                        }
                    } else {
                        api.closeWin();
                    }
                },
                error: function(data, status, e) {
            }
        }); 
    }

    function RefreshWGHome()
    { 
        api.openWin({
            name: 'win_shyhome',
            url: 'win_shyhome.html',
            bounces: false,
            delay: 200,
            reload:true,
        });

        api.closeWin({
            name: 'win_shyzplist',
            url: 'win_shyzplist.html',
        });
    }

    function ChangedItems()
    {
        var vHGXM = "";
        for(var i=0;i<chkHGXM.length;i++)
        {
            vHGXM += chkHGXM[i]+",";
        }
        $("#txtHGXM").val(vHGXM);

        var vBHGX = "";
         for(var i=0;i<chkBHGX.length;i++)
        {
            vBHGX += chkBHGX[i]+",";
        }
        $("#txtBHGX").val(vBHGX);

        var vBHGX_Sub = "";
        for(var i=0;i<chkBHGX_SUB.length;i++)
        {
            vBHGX_Sub += chkBHGX_SUB[i]+",";
        }
        $("#txtBHGX_Sub").val(vBHGX_Sub);

        var vPBXM = "";
        for(var i=0;i<chkPBXM.length;i++)
        {
            vPBXM += chkPBXM[i]+",";
        }
        $("#txtPBXM").val(vPBXM);
    }

    function AddBHGX(obj)
    {
        var thisObj = $(obj); 

        thisObj.parent().attr("style","color:black;");
        var isChecked =thisObj.is(':checked');
        if(isChecked)
        {
            $("#divSub" + thisObj.val()).show();

            thisObj.parent().attr("style","color:red;");
            var vSelected = thisObj.val();

            var index_HGXM = $.inArray(vSelected, chkHGXM); 
            if (index_HGXM >= 0) {
                chkHGXM.splice($.inArray(vSelected,chkHGXM),1);
            }    

            var index_BHGX = $.inArray(vSelected, chkBHGX); 
            if (index_BHGX < 0) {
                chkBHGX.push(vSelected); 
            }

            var index_PBXM = $.inArray(vSelected, chkPBXM); 
            if (index_PBXM >= 0) {
                chkPBXM.splice($.inArray(vSelected,chkPBXM),1);
            }
        }
        ChangedItems();
    }

    function AddBPDX(obj)
    {
        var thisObj = $(obj);
        $("input[name='"+obj.name+"']").parent().attr("style","color:black;");
        var isChecked = $(obj).is(':checked');
         if(isChecked)
         {
            $("#divSub" + thisObj.val()).hide();

            $(obj).parent().attr("style","color:blue;");
            var vSelected = $(obj).val();
           
            var index_HGXM = $.inArray(vSelected, chkHGXM); 
            if (index_HGXM >= 0) {
                chkHGXM.splice($.inArray(vSelected,chkHGXM),1);
            }    

            var index_BHGX = $.inArray(vSelected, chkBHGX); 
            if (index_BHGX >= 0) {
                chkBHGX.splice($.inArray(vSelected,chkBHGX),1);
            }

            var index_PBXM = $.inArray(vSelected, chkPBXM); 
            if (index_PBXM < 0) {
                chkPBXM.push(vSelected); 
            }

            var vParID = thisObj.val();
            for(var i=chkBHGX_SUB.length-1;i>=0;i--)
            {
                var vCurId = chkBHGX_SUB[i].split('-')[0];
                if(vParID == vCurId)
                {
                    $("#chk" + chkBHGX_SUB[i]).removeAttr("checked");
                    chkBHGX_SUB.splice($.inArray(chkBHGX_SUB[i],chkBHGX_SUB),1); 
                }
            }
         }
         ChangedItems();
    }

    function AddHGXM(obj)
    {
        var thisObj = $(obj);
        $("input[name='"+obj.name+"']").parent().attr("style","color:black;");
        var isChecked = $(obj).is(':checked');
         if(isChecked)
         {
            $("#divSub" + thisObj.val()).hide();

            $(obj).parent().attr("style","color:black;");
            var vSelected = $(obj).val();
           
            var index_HGXM = $.inArray(vSelected, chkHGXM); 
            if (index_HGXM < 0) {
                 chkHGXM.push(vSelected); 
                
            }    

            var index_BHGX = $.inArray(vSelected, chkBHGX); 
            if (index_BHGX >= 0) {
                chkBHGX.splice($.inArray(vSelected,chkBHGX),1);
            }

            var index_PBXM = $.inArray(vSelected, chkPBXM); 
            if (index_PBXM >= 0) {
                chkPBXM.splice($.inArray(vSelected,chkPBXM),1);
            }

            var vParID = thisObj.val();
            for(var i=chkBHGX_SUB.length-1;i>=0;i--)
            {
                var vCurId = chkBHGX_SUB[i].split('-')[0];
                if(vParID == vCurId)
                {
                    $("#chk" + chkBHGX_SUB[i]).removeAttr("checked");
                    chkBHGX_SUB.splice($.inArray(chkBHGX_SUB[i],chkBHGX_SUB),1); 
                }
            }
         }
        ChangedItems();
    }

    function AddBHGX_Sub(obj)
    {
        var thisObj = $(obj);
        var vSelected = $(obj).val(); 

        thisObj.parent().attr("style","color:black;");
        var isChecked =thisObj.is(':checked');
        if(isChecked)
        {
            var index_BHGX_Sub = $.inArray(vSelected, chkBHGX_SUB); 
            if (index_BHGX_Sub < 0) {
                chkBHGX_SUB.push(vSelected); 
            }
        }
        else
        {
            var vSelected = $(obj).val();
            var index_BHGX_Sub = $.inArray(vSelected, chkBHGX_SUB); 
            if (index_BHGX_Sub >= 0) {
                chkBHGX_SUB.splice($.inArray(vSelected,chkBHGX_SUB),1); 
            }
        }
        ChangedItems();
    }

    function ShowDZQM(obj)
    {
         var thisObj = $(obj);
        var vText = thisObj.html();
        if(vText == "显 示")
        {
            thisObj.html("隐 藏");

            drawingBoard.show();
            drawingBoard.open({
            rect: {
                x: 0,
                y: 50,
                w: api.frameWidth,
                h: 150
            },
            styles: {
                brush: {
                    color: '#000',
                    width: 6
                },
                bgColor: '#ff0'
            },
                fixedOn: api.frameName
            });
        }
        else
        {
            drawingBoard.hide();
            thisObj.html("显 示");
        }
    }

    function SaveDZQM()
    {
        if($("#btnShowDZQM").html() == "隐 藏")
        {
            var vUrlWrite = $api.getStorage('ServerUrlWrite');

            drawingBoard.save({
            savePath: 'fs://drawingBoard/result.png',
                copyToAlbum: false
            }, function(ret) {

                var vId = api.pageParam.ID;
                api.ajax({
                url: vUrlWrite + '/WcfServices/SHY_SaveDZQMImg/'+ vId,
                method: 'post',
                headers: {
                    "X-APICloud-AppId": "****",
                },
                data: {    
                files: {
                    "file": ret.absolutePath
                        }
                    }
                }, function(ret, err) {
                if (ret.IsSuccess) {
                       alert("保存成功！");
                    }
                });
            });
        }
    }

    //清除电子签名
    function ClearDZQM()
    {
          drawingBoard.clear();
    }

    /**
     * 正整数
     * min-最小长度 max-最大长度
     */
    function Lthwsd_Valid(value)
    {
        if(value == "" || $.trim(value).length == 0)
        {
            return true;
        }
        else
        {
            if(value.indexOf(":")>0 && value.indexOf("/")>0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
</script>